JE=/usr/local/package/je-4.0.71/lib/je-4.0.71.jar
##DB_HOME=-db-home /tmp/bdb
##LOG= -log-level "ALL" 
CMDLINE=java -enableassertions -cp dist/operonj.jar:${JE} fr.cephb.operonj.tools.cmdline
CMDFLAG=${DB_HOME}  ${LOG}
BOWTIE_HOME=/home/pierre/tmp/BOWTIE/bowtie-0.10.1

map_build37_1: distribution
	rm -f /operon/lindenb/build37bdb/*
	${CMDLINE}.remapper.Build37Mapper -p load-dbsnp /operon/inc/dbsnp/ds_*.xml.gz
map_build37_2: distribution
	java -enableassertions -cp dist/operonj.jar:/usr/local/package/je-4.0.71/lib/je-4.0.71.jar fr.cephb.operonj.tools.cmdline.remapper.Build37Mapper -p map-flanking -uniq -flanking-size 60

test: distribution
	rm -f /tmp/bdb/*
	rm -f /tmp/_bowtie_*
	${CMDLINE}.BuildLoad ${CMDFLAG} -policy REPLACE_IF_EXISTS files/builds.xml
	${CMDLINE}.ChromLoad ${CMDFLAG} files/segments.xml
	${CMDLINE}.remapper.ReMapper ${CMDFLAG} -p load-positions /home/pierre/tmp/BOWTIE/snpChr22Hg18.txt.gz
	${CMDLINE}.remapper.ReMapper ${CMDFLAG} -p load-dbsnp /home/pierre/tmp/BOWTIE/ds_ch22.xml.gz
	${CMDLINE}.remapper.ReMapper ${CMDFLAG} -bowtie-home ${BOWTIE_HOME} -bowtie-db build37 -uniq -p map-flanking -flanking-size 60 
	${CMDLINE}.remapper.ReMapper ${CMDFLAG} -blat-binary /home/pierre/bin/i386/blat -uniq -bowtie-db build36 -p blat-flanking -flanking-size 200
	${CMDLINE}.remapper.ReMapper ${CMDFLAG} -blat-binary /home/pierre/bin/i386/blat -uniq -bowtie-db build36 -p blat-flanking -flanking-size 60
	${CMDLINE}.remapper.ReMapper ${CMDFLAG} -blat-binary /home/pierre/bin/i386/blat -bowtie-db build36 -p blat-flanking -flanking-size 60 
	${CMDLINE}.remapper.ReMapper ${CMDFLAG} -p dump > jeter.xml
	${CMDLINE}.remapper.ReMapper ${CMDFLAG} -p resolve-neighbours
	xmllint --format jeter.xml > a
	mv a jeter.xml
	rm -f /tmp/bdb/*

distribution:
	rm -rf build/META-INF build/fr
	mkdir -p build/META-INF/schema
	mkdir -p dist/
	cp -r src/java/* build/
	cp -r schema build/META-INF/
	javac -sourcepath build -cp ${JE} -d build build/fr/cephb/operonj/tools/cmdline/*.java \
		build/fr/cephb/operonj/tools/cmdline/remapper/*.java
	jar cf dist/operonj.jar -C build .


testold:distribution
	${CMDLINE}.BuildLoad ${CMDFLAG} -policy REPLACE_IF_EXISTS files/builds.xml
	${CMDLINE}.BuildDrop ${CMDFLAG} 3 87
	${CMDLINE}.BuildDump ${CMDFLAG}
	${CMDLINE}.ChromLoad ${CMDFLAG} files/segments.xml
	${CMDLINE}.FastaCmd ${CMDFLAG} -b 1 -c 1 -s 0 -e 10000
